Visual Behavior Programming with Automatic Script Code Generation


Shigeo Nakagawa and Hirofumi Ishida
C&C Research Laboratories, NEC Corporation


We present a VRML2.0 content authoring tool with an intuitive visual behavior programming interface. The main features of this tool are: (1) a high-level visual programming editor that facilitates the action transition descriptions, and (2) automatic Java script code generation from visual programs produced with the editor.

VRML2.0 has recently attracted a great deal of attention as the Internet standard for interactive 3D contents, then a number of authoring tools to support VRML2.0 behavior programming have appeared. While such tools may be powerful, however, they require an author to program in Java or JavaScript, in which many potential users may be expected to lack sufficient programming skills. What is needed here is a simpler authoring tool that can release users from this requirement.

Visual Behavior Programming Tool

Fig. 1 shows a portion of a visual program describing transitions of 3D object actions. To create this sort of program, an author correlates object actions to corresponding icons and specifies the events (e.g., mouse-clicks from a TouchSensor node) that will trigger such individual actions. Finally, the author connects the icons in the order in which the actions are to be executed. Branches and loops can also be used as sequence connections.


Fig. 1


In Fig. 1, the object continues "standing" until a click triggers its "walking". Its next action ("jump" or "turn" ) depends on whether the next event is "action-completion" or "click". The author can also synchronize the actions of multiple objects through the use of a message-passing mechanism in which the action "send-message" triggers the event "message-received".

Automatic Java Script Code Generation

However actual execution of a program like the one illustrated in Fig.1 with a VRML2.0 browser requires the translation of the visually represented program into Java script code. We have developed a way for such code to be generated automatically. Fig. 2 illustrates how this works.

Fig. 2


The script code generator scans the visual program and converts both the data and the program-structure described in the program into Java language program texts. The generator generates the following three types of codes: (1)initialization, (2)event handler, and (3) action-methods, which are taken together to comprise a script code. The initialization portion consists of the declaration of event-output ports ("eventOut") to the Script node, a data array related to object actions, such as key-frame trajectory motions, and a list-structured data array containing event-action pairs in each node. The event handler portion is a function that determines what action is to follow an event that has been sent in through the processEvent() method. The action-methods portion contains functions to execute object actions. This might be, for example, a trajectory motion data function calculating the position of the object and sending the relevant values (position, rotation, and scaling) to the Transform node through the "eventOut" port. Fig. 3 shows an example of generated contents with the CommuniyPlace(TM) Browser.


Fig. 3


Conclusions and Future Work

This tool enables an author to manage object actions as individual graphical icons, greatly facilitating the authoring process. Further, since the actual execution of actions in 3D views are accompanied by synchronized indications of activated icons, tracing and debugging are also made much easier because it can all be performed visually. We are currently in process of improving the user interface and optimizing the generated source code to increase execution speed.

The Video Demonstration

Caption:

The character object has several actions and performs them sequentially. These icons represent individual actions and the corresponding trigger events. For the example, we show you the creation of an icon. At first, we make a default (blank) icon and select the "mouse click" event as the trigger of this icon. Then we make a new trajectory motion for the action. We provide a simple trajectory-motion editor for this purpose. After the creation of a branch of the program's execution, we make a loop back icon to the first action, by a copy and paste operation.

We show you two examples, generated by the automatic script code generator. The first example is an interactive 3D model of a PC set-up. The model PC can be broken down by clicking individual parts and the user can see inside the PC box. The second example shows a prototype example of the Internet directory service. When the user clicks a 3D keyword icon, this system provides related information on the HTML browser. The interface agent character advises the user of the usage of this system.

Contact

Shigeo Nakagawa and Hirofumi Ishida

C&C Research Laboratories, NEC Corporation
4-1-1 Miyazaki Miyamae-ku, Kawasaki 216 JAPAN
+81.44.856.2294
+81.44.856.2388 fax
[naka,ishida]@mmp.cl.nec.co.jp